package com.cheyun.netsalev3.repository

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider

/**
 *
 *用于创建带有构造函数ViewModel的工厂
 */
class ViewModelFactory(private val creakViewModel: () -> ViewModel) : ViewModelProvider.NewInstanceFactory() {
    @Suppress("UNCHECKED_CAST")
    override fun <T : ViewModel> create(modelClass: Class<T>): T {
        return creakViewModel() as T
    }

}